package com.fintech.third.model;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;

import javax.net.ssl.SSLSocket;

public class Accepter implements Runnable {

	private SSLSocket socket;

	public Accepter(SSLSocket socket) {
		this.socket = socket;
	}

	public void service() {
		Thread thread = new Thread(this);
		thread.start();
	}

	@Override
	public void run() {
		try {
			InputStream inputStream = socket.getInputStream();

			InputStreamReader inputstreamreader = new InputStreamReader(inputStream);
			BufferedReader bufferedreader = new BufferedReader(inputstreamreader);

			String string = null;
			while ((string = bufferedreader.readLine()) != null) {
				System.out.println(string);
				System.out.flush();
			}
		} catch (Exception e) {
			// replace with other code
			e.printStackTrace();
		}
	}
}
